package xyz.scootaloo.mono.security.token

import org.apache.shiro.authc.AuthenticationToken
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

/**
 * 对请求报文中的jwt信息进行封装
 *
 * 这里包含了request和response, 由于受shiro框架的限制,
 * 需要在用户访问被拒时返回json提示, 用直接向response中写入内容实现
 *
 * @author flutterdash@qq.com
 * @since 2021/7/25 21:44
 */
data class JwtToken(
    val token: String,
    val request: HttpServletRequest,
    val response: HttpServletResponse
) : AuthenticationToken {

    override fun getPrincipal(): Any = token
    override fun getCredentials(): Any = token

}
